//
//  LRXThing.m
//  路人侠
//
//  Created by zhangxulong on 2/9/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXThing.h"
#import "LRXBuyStoreModel.h"
@implementation LRXThing
- (instancetype)initThingWith:(NSDictionary *)dic
{
    if (self = [super init]) {
        self.thingName = dic[@"name"];
        self.thingIcon = dic[@"pic_url"];
        self.thingMoney = [NSString stringWithFormat:@"%.2lf",[dic[@"price"] floatValue] / 100 ];
        self.detailText = dic[@"detail"];
        self.thingId = dic[@"id"];
        self.thingCount = dic[@"pivot"][@"count"];
        self.doubleThingMoney = [NSString stringWithFormat:@"%.2lf",[dic[@"price"] floatValue] / 100 * [self.thingCount intValue]];
        self.storeName = dic[@"store"][@"name"];
        self.storeID = dic[@"store"][@"id"];
    }
    return self;
}

+ (instancetype)thingWith:(NSDictionary *)dic
{
    return [[LRXThing alloc]initThingWith:dic];
}

@end
